package com.bj.dz.controller;

import com.bj.dz.entity.StationBuilding;
import com.bj.dz.service.StationBuildingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/***
*   控制器
*/
@Slf4j
@Api(tags = "【stationBuilding】提供服务接口")
@RestController
@RequestMapping("/stationBuilding")
public class StationBuildingController {

    @Resource
    private StationBuildingService stationBuildingService;

    /**
    * 通过id查询
    * @param
    * @return
    */
    @ApiOperation(value = "查找服务")
    @RequestMapping(value="/findById",method = RequestMethod.POST, produces = "application/json;" +"charset=UTF-8")
    public StationBuilding findStationBuildingById(@ApiParam(name = "id",value = "StationBuilding的id",required = true) @RequestParam(value = "id",required=true)Integer id){
        return stationBuildingService.getStationBuildingById(id);
    }

    /**
    * 通过多个查询
    * @param
    * @return
    */
    @ApiOperation(value = "查找多个服务")
    @RequestMapping(value="/findStationBuildings",method = RequestMethod.POST, produces = "application/json;" +"charset=UTF-8")
    public List<StationBuilding> findStationBuildingListByMap(@ApiParam(name = "StationBuilding",value = "stationBuilding",required = true)@RequestBody StationBuilding stationBuilding){

        return stationBuildingService.getStationBuildingListByMap(null);
    }

    /**
    * 查询总数
    * @param
    * @return
    */
    @ApiOperation(value = "获取总数服务")
    @RequestMapping(value="/count",method = RequestMethod.POST, produces = "application/json;" +"charset=UTF-8")
    public Integer StationBuildingCount(){
        return stationBuildingService.getStationBuildingCountByMap(null);
    }

    /**
    * 添加保存
    * @param
    * @return
    */
    @ApiOperation(value = "添加服务")
    @RequestMapping(value="/add",method = RequestMethod.POST, produces = "application/json;" +"charset=UTF-8")
    public boolean addStationBuilding(@ApiParam(name = "StationBuilding",value = "stationBuilding对象",required = true)@RequestBody StationBuilding stationBuilding){
            return stationBuildingService.addStationBuilding(stationBuilding);
    }

    /**
    * 更新修改
    * @param
    * @return
    */
    @ApiOperation(value = "更新修改服务")
    @RequestMapping(value="/upd",method = RequestMethod.POST, produces = "application/json;" +"charset=UTF-8")
    public boolean modifyStationBuilding(@ApiParam(name = "StationBuilding",value = "stationBuilding对象",required = true)@RequestBody StationBuilding stationBuilding){
        return stationBuildingService.modifyStationBuilding(stationBuilding);
    }

    /**
    * 删除
    * @param
    * @return
    */
    @ApiOperation(value = "删除服务")
    @RequestMapping(value="/del",method = RequestMethod.POST, produces = "application/json;" +"charset=UTF-8")
    public boolean deleteStationBuildingById(@ApiParam(name = "StationBuilding",value = "stationBuilding的id",required = true) @RequestParam(value = "id",required=true)Integer id){
        return stationBuildingService.deleteStationBuildingById(id);
    }



}
